package com.gogowan.agroenterprise;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;

public class ActivityCollector {

	public static List<Activity> activities = new ArrayList<Activity>();
    /**
     * 将Activity放进listview
     * @param activity
     */
	public static void addActivity(Activity activity) {
		activities.add(activity);
	}

	public static void removeActivity(Activity activity) {
		if(activities.contains(activity))
		activities.remove(activity);
	}

	public static void finishAll() {
		//list数量大于0再逐一销毁
		if (activities.size() > 0) {
			for (Activity activity : activities) {
				if (!activity.isFinishing()) {
					activity.finish();
				}
			}
		}
	}

}
